let app=getApp();
let API=require('../../api.js').API;
let util=require('../../utils/util');
let req=require('../../utils/request').Request;

Component({
  name: 'my-scrollview',
  properties: {
    scrollHeight: {
      type: Number,
      value: 0
    },
    state:{
      type: String,
      value: "0"
    },
    byUser:{
      type:Boolean,
      value:false
    }
  },
  data: {

  },
  methods: {
    refresh: function () {
      let that=this;
      //待补充获取订单
      let token = app.globalData.token;
      req.get(API.getOrders + '?token=' + token + '&state='+that.data.state+'&byUser='+that.data.byUser)
        .then(function (res) {
          console.log(res);
          that.triggerEvent("refresh",res);
        }).catch(function (res) {
          console.log(res);
        })
    },
    finish: function () {
      this.setData({
        pulling: false
      });
    }
  }
});